package chapter01
import java.io.PrintWriter
object Test06_infoOutput {
  def main(args: Array[String]): Unit = {
    //接收输入
    println("请输入姓名：")
    val name = scala.io.StdIn.readLine()
    println("请输入学号：")
    val id = scala.io.StdIn.readLine()
    println("请输入班级：")
    val grade = scala.io.StdIn.readLine()
    println("请输入电话：")
    val phone = scala.io.StdIn.readLine()
    val info = s"""|++++++++++++++
                    |姓名：${name}
                    |学号：${id}
                    |班级：${grade}
                    |电话：${phone}
                    |+++++++++++++
                    |""".stripMargin
    //写入文件
    val writer = new PrintWriter("info.txt","utf-8")
    writer.write(info)
    //关闭文件
    writer.close()
  }
}
